<?php
/**
 * RUBIK IT Solution & Development ltd.
 *
 * PROJECT		: [Project name]
 * COPYRIGHT	: 2008
 * ------------------------------------------------------
 *
 * [GENERAL INFO OF THIS FILE]
 *
 * @author			nguyennt <nguyennt@rubik.com.vn>
 * @access			[public/private]
 * @package		 [package name]
 *
 * Created on	:Jul 30, 2008
 */

header ( "Content-Type: text/javascript" );

// Define URL information
//$sProtocol = $_SERVER ["SERVER_PROTOCOL"];
//$sProtocol = substr ( $sProtocol, 0, strpos ( $sProtocol, "/" ) );
//$sProtocol = strtolower ( $sProtocol ) . "://";


if (!empty($_SERVER['HTTPS'])){
	if($_SERVER['HTTPS']) {
		$sProtocol = 'https';
	} else {
		$sProtocol = 'http';
	}
}else {
	$sProtocol = 'http';
}
$sProtocol = strtolower ( $sProtocol ) . "://";


$sHostName = $_SERVER ['HTTP_HOST'];
$arr = explode ( "/", $_SERVER ['PHP_SELF'] );
$i = count ( $arr ) - 1;
if ($i >= 0) {
	unset ( $arr [$i] );
	$i --;
	unset ( $arr [$i] );
	$i --;
	unset ( $arr [$i] );
	$i --;
}
$uri = implode ( "/", $arr );
$rootUrl = $sProtocol . $sHostName . $uri . "/"; // do not modify this line


echo "var SYS_ROOT_URL_WITHOUT_PROTOCOL = '$uri';\r\n";
echo "var SYS_ROOT_URL = '$rootUrl';\r\n";
echo "
url = document.location.href;
if (url.indexOf(SYS_ROOT_URL + 'administrator') > -1 ) {
	SYS_ROOT_URL = SYS_ROOT_URL + 'administrator/';
}
";
echo file_get_contents ( "core.js" );
?>